@extends('admin.layout')

@section('content')
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">文章列表</h1>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="dataTable_wrapper">
            <table class="table table-striped table-hover" id="dataTables-example">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>标题</th>
                        <th>标签</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                @foreach($articles as $article)
                    <tr>
                        <td width="10%">{{ $article->id }}</td>
                        <td width="40%">{{ $article->title }}</td>
                        <td width="20%">{{ $article->tag?:'-' }}</td>
                        <td width="15%">{{ $article->created_at }}</td>
                        <td width="15%">
                            {!! Form::open(['method' => 'get', 'url' => 'admin/article/'.$article->id.'/edit', 'style' => 'float:left;margin-right: 10px;']) !!}
                                <button type="submit" class="btn btn-success btn-sm iframe cboxElement"><span class="glyphicon glyphicon-pencil"></span>修改</button>
                            {!! Form::close() !!}

                            {!! Form::open(['method' => 'delete', 'url' => 'admin/article/'.$article->id, 'style' => 'float:left;margin-right: 10px;']) !!}
                                <button type="submit" class="btn btn-sm btn-danger iframe cboxElement"><span class="glyphicon glyphicon-trash"></span>删除</button>
                            {!! Form::close() !!}
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
        <div class="row">
            <div class="col-sm-7 pull-left">
                每页{{ $articles->count() }}条,共{{ $articles->lastPage() }}页,总{{ $articles->total() }}条.
            </div>
            <div class="col-sm-5 page">
                {!! $articles->render() !!}
            </div>
        </div>
    </div>
</div>
@endsection
